#ifndef __L3GD20_H_
#define __L3DG20_H_


#define GYRO_FLAG_READ      0x80
#define GYRO_FLAG_WRITE     0x00
#define GYRO_FLAG_SEQ       0x40
#define GYRO_FLAG_NOSEQ     0x00

#define GYRO_REG_WHO_AM_I     0x0F
#define GYRO_REG_CTRL_REG1    0x20
#define GYRO_REG_CTRL_REG2    0x21
#define GYRO_REG_CTRL_REG3    0x22
#define GYRO_REG_CTRL_REG4    0x23
#define GYRO_REG_CTRL_REG5    0x24
#define GYRO_REG_REF_DATACAP  0x25
#define GYRO_REG_OUT_TEMP     0x26
#define GYRO_REG_STATUS       0x27
#define GYRO_REG_OUT_X_L      0x28
#define GYRO_REG_OUT_X_H      0x29
#define GYRO_REG_OUT_Y_L      0x2A
#define GYRO_REG_OUT_Y_H      0x2B
#define GYRO_REG_OUT_Z_L      0x2C
#define GYRO_REG_OUT_Z_H      0x2D
#define GYRO_REG_FIFO_CTRL    0x2E
#define GYRO_REG_FIFO_SRC     0x2F
#define GYRO_REG_INT1_CFG     0x30
#define GYRO_REG_INT1_SRC     0x31
#define GYRO_REG_INT1_THS_XH  0x32
#define GYRO_REG_INT1_THS_XL  0x33
#define GYRO_REG_INT1_THS_YH  0x34
#define GYRO_REG_INT1_THS_YL  0x35
#define GYRO_REG_INT1_THS_ZH  0x36
#define GYRO_REG_INT1_THS_ZL  0x37
#define GYRO_REG_INT1_DURA    0x38

#define GYRO_ODR_95  0x00
#define GYRO_ODR_190 0b01000000
#define GYRO_ODR_380 0b10000000
#define GYRO_ODR_760 0b11000000

#define GYRO_LP_BW1 0b00000000
#define GYRO_LP_BW2 0b00010000
#define GYRO_LP_BW3 0b00100000
#define GYRO_LP_BW4 0b00110000

#define GYRO_ENABLE 0b00001111

#define GYRO_HP_MODE_MASK 0b00110000

#define GYRO_BDU 0b10000000
#define GYRO_BLE 0b01000000

#define GYRO_FULL_SCALE_250  0b00000000
#define GYRO_FULL_SCALE_500  0b00010000
#define GYRO_FULL_SCALE_1000 0b00100000
#define GYRO_FULL_SCALE_2000 0b00110000

#define GYRO_SPI_MODE 0b00000001

//CTRL_REG4
#define GYRO_I1_INT1         0b10000000
#define GYRO_I1_BOOT         0b01000000
#define GYRO_H_LACTIVE       0b00100000
#define GYRO_PP_OD           0b00010000
#define GYRO_I2_EN           0b00001000
#define GYRO_I2_WTM          0b00000100
#define GYRO_I2_OVERRUN      0b00000010
#define GYRO_I2_EMPTY        0b00000001


//CTRL_REG5
#define GYRO_FIFO_ENABLE     0b01000000
#define GYRO_HP_ENABLE       0b00010000
#define GYRO_INT1_SEL_MASK   0b00001100
#define GYRO_OUT_SELECT0     0b00000000
#define GYRO_OUT_SELECT1     0b00000001
#define GYRO_OUT_SELECT2     0b00000010

//FIFO_CTRL_REG
#define GYRO_FIFO_MODE_BYPASS           0b00000000
#define GYRO_FIFO_MODE_FIFO             0b00100000
#define GYRO_FIFO_MODE_STREAM           0b01000000
#define GYRO_FIFO_MODE_STREAM_TO_FIFO   0b01100000
#define GYRO_FIFO_MODE_BYPASS_TO_STREAM 0b10000000
#define GYRO_FIFO_WATERMARK_MASK        0b00011111





#endif

